package com.adingxiong.cft.constant;

public enum TempalteEnum {

    userInfo("userInfo", "/templates/use-info-template.ftl","用户信息导出.doc"),

    repair("repair", "/templates/repair_report.docx", "维修信息记录单.docx"),

    NULL(null,null,null);

    private String type;

    private String filePath;

    private String fileName;

    private TempalteEnum (String type,String filePath,String fileName){
        this.type = type;
        this.fileName = fileName;
        this.filePath = filePath;
    }

    public String getType() {
        return type;
    }

    public String getFilePath() {
        return filePath;
    }

    public String getFileName() {
        return fileName;
    }

    /**
     * 根据类型值获取对应枚举对象
     *
     * @param typeStr
     * @return
     */
    public static TempalteEnum getByType(String typeStr) {
        TempalteEnum[] values = TempalteEnum.values();
        for (TempalteEnum importTypeEnum : values) {
            if (!NULL.equals(importTypeEnum) && importTypeEnum.type.equals(typeStr)) {
                return importTypeEnum;
            }
        }
        return NULL;
    }

}
